﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.Services;
using System.Threading;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Data.SqlClient;
using System.Collections.Generic;
using EShop.BussinessObjects;
using EShop.Common;
using EShop.DataAccess;

public partial class WeeklyMenu : BaseThemePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        CompanyWeeklyMenu weeklyMenu_Filter = new CompanyWeeklyMenu();
        weeklyMenu_Filter.ID = (int)cnstDatabase.DBOperationResult.ValueIsNotEffective;
        weeklyMenu_Filter.Company = new Company();
        weeklyMenu_Filter.Company.ID = CGlobalData.GetCurrentCompanyID();
        weeklyMenu_Filter.DayOfWeek = (int)cnstDatabase.DBOperationResult.ValueIsNotEffective;
        List<CompanyWeeklyMenu> companyWeeklyMenuList = CDACompanyWeeklyMenu.Select(weeklyMenu_Filter);
        for (int i = 1; i <= 7; i++)
        {
            List<CompanyWeeklyMenu> companyWeeklyMenuList_Day = companyWeeklyMenuList.Where(t => t.DayOfWeek == i).ToList<CompanyWeeklyMenu>();

            String dayMenu = "";
            foreach (CompanyWeeklyMenu companyWeeklyMenu in companyWeeklyMenuList_Day)
                dayMenu += companyWeeklyMenu.Product.Name + " - ";
            if (dayMenu != "")
                dayMenu = dayMenu.Substring(0, dayMenu.Length - 3);

            switch (i)
            {
                case 1:
                    spnDay1.InnerText = dayMenu;
                    break;
                case 2:
                    spnDay2.InnerText = dayMenu;
                    break;
                case 3:
                    spnDay3.InnerText = dayMenu;
                    break;
                case 4:
                    spnDay4.InnerText = dayMenu;
                    break;
                case 5:
                    spnDay5.InnerText = dayMenu;
                    break;
                case 6:
                    spnDay6.InnerText = dayMenu;
                    break;
                case 7:
                    spnDay7.InnerText = dayMenu;
                    break;
            }
        }
        
    }
}